<?php

class WorkItemsModel extends BDModel {

    function __construct($column = null, $value = null, $params = null){

        $this->table = "work_items";
        parent::__construct($column, $value, $params);
        $data = $this->getData();

    }

    function getItems($options = array()){
        /// AND items.is_active = 1

        $work_categories_id = 500;

        if(isset($options['work_categories_id'])) $work_categories_id = $options['work_categories_id'];

        $query = "
                  SELECT categories.work_categories_id, types.work_types_name, items.* FROM `work_items` items
                  left JOIN `work_types` types ON types.work_types_id = items.work_types_id
                  left JOIN `work_categories` categories ON types.work_categories_id = categories.work_categories_id

                  WHERE categories.work_categories_id = $work_categories_id

                  ORDER BY types.work_types_name;
          ";

        $this->Sql($query);
        $this->Go();

        return $this->getData();
    }



}
